#include <stdio.h>
#include <stdlib.h>

#define GALLEON 2
#define KNUT    0
#define BIT     (GALLEON+1)
long Hex[BIT] = {29, 17, 1};

int comp(long *ActPay, long *ShouldPay)
{
	int i;
	for(i = GALLEON; i >= KNUT; i--)
	{
		if(ActPay[i] > ShouldPay[i])
		{
			return 1;
		}
		else if(ActPay[i] < ShouldPay[i])
		{
			return -1;
		}
	}
	return 0;
}

int main(int argc, int **argv)
{
	long temp;
	long ShouldPay[BIT] = {0};
	long ActPay[BIT] = {0};
	long Res[BIT] = {0};
	int  i, CompRes;

	for(i = GALLEON; i >= KNUT; i--)
	{
		scanf("%ld", &ShouldPay[i]);
		getchar();
	}
	for(i = GALLEON; i >= KNUT; i--)
	{
		scanf("%ld", &ActPay[i]);
		getchar();
	}

	CompRes = comp(ActPay, ShouldPay);
	if(CompRes < 0)
	{
		for(i = GALLEON; i >= KNUT; i--)
		{
			temp = ShouldPay[i];
			ShouldPay[i] = ActPay[i];
			ActPay[i] = temp;
		}
	}

	for(i = KNUT; i <= GALLEON; i++)
	{
		if(ActPay[i] < ShouldPay[i] && i < GALLEON)
		{
			ActPay[i] += Hex[i];
			ActPay[i+1]--;
		}
		Res[i] = ActPay[i] - ShouldPay[i];
	}

	if(CompRes < 0)
	{
		Res[GALLEON] = -Res[GALLEON];
	}
	for (i = GALLEON; i >= KNUT; i--)
	{
		printf("%ld", Res[i]);
		if(i != KNUT)
		{
			printf(".");
		}
	}

	return 0;
}